'''
Author: WuFeng <763467339@qq.com>
Date: 2024-11-19 14:13:42
LastEditTime: 2024-11-19 14:14:53
LastEditors: WuFeng <763467339@qq.com>
Description: PDF转WORD
FilePath: \markdown-magic\python\service\PdfToDocx.py
Copyright 版权声明
'''
from pdf2docx import Converter

def convert_pdf_to_word(pdf_file, word_file):
  try:
    # 创建转换器对象
    cv = Converter(pdf_file)
    
    # 执行转换操作
    cv.convert(word_file, start=0, end=None)
    
    # 关闭转换器
    cv.close()
  except Exception as e:
    print(f"转换失败：{e}")
    return False
  return True